{% extends "events/base.html" %}
{% load i18n %}

{% block breadcrumbs %}{% if not is_popup %}
<div class="breadcrumbs">
     <a href="../../../">Home</a> &rsaquo;
     <a href="../../">Event Manager</a> &rsaquo;
     <a href="../">Voting</a> &rsaquo;
     {{user.first_name}} {{user.last_name}} voting record
     
</div>
{% endif %}{% endblock %}

{% block content %}
<h1>Voting metrics for  {{user.first_name}} {{user.last_name}} </h1>


<h2>{{user.first_name}} {{user.last_name}}'s Overall Metrics</h2>

<table>
	<hr>
		<th align=center>Approve</th>
		<th align=center>Reject</th>
		<th align=center>Abstain</th>
		<th align=center>No Vote</th>
		<th align=center>Average Time</th>
		<th align=center>Shortest</th>
		<th align=center>Longest</th>
	</hr>
	<tr>
		<td align=center>{{member_stat.approve}}</td>
		<td align=center>{{member_stat.reject}}</td>
		<td align=center>{{member_stat.abstain}}</td>
		<td align=center>{{member_stat.novote}}</td>
		<td align=center>{{member_stat.average}}</td>
		<td align=center>{{member_stat.min.event}} ({{member_stat.min.value}})</td>
		<td align=center>{{member_stat.max.event}} ({{member_stat.max.value}})</td>
	</tr>
</table>

<h2>Metrics by Event Type</h2>

<table>
	<hr>
		<th align=center>Event Type</th>
		<th align=center>Approve</th>
		<th align=center>Reject</th>
		<th align=center>Abstain</th>
		<th align=center>No Vote</th>
		<th align=center>Average Time</th>
		<th align=center>Shortest</th>
		<th align=center>Longest</th>
	</hr>
	{%for stat in event_stats %}
	<tr>
		<td align=center>{{stat.type}}</td>
		<td align=center>{{stat.approve}}</td>
		<td align=center>{{stat.reject}}</td>
		<td align=center>{{stat.abstain}}</td>
		<td align=center>{{stat.novote}}</td>
		<td align=center>{{stat.average}}</td>
		<td align=center>{{stat.min.event}} ({{stat.min.value}})</td>
		<td align=center>{{stat.max.event}} ({{stat.max.value}})</td>
	</tr>
	</tr>
	{% endfor %}	
</table>
<br />

<h2>Voting Record</h2>

<table>
	<hr>
		<th align=center>Event</th>
		<th align=center>Vote</th>
		<th align=center>Timestamp</th>
	</hr>
	{%for vote in votes %}
	<tr>
		<td align=center>{{vote.event}}</td>
		<td align=center>{{vote.get_vote_display}}</td>
		<td align=center>{{vote.vote_date|date:"Y/m/d H:i"}}</td>
	</tr>
	{% endfor %}
</table>

{% endblock %}
